package cn.sc.allinpay.allfavour.business.setremark;

import android.text.TextUtils;

import cn.pai.mvp.presenter.PaiPresenter;
import cn.sc.allinpay.allfavour.app.Constant;
import cn.sc.allinpay.allfavour.business.common.utils.SpUtils;

/**
 * 设置验券备注 presenter
 * author：pany
 * on 2017/12/1 11:27
 */
public class SetRemarkPresenter extends PaiPresenter<SetRemarkContract.View> implements SetRemarkContract.Presenter {

    private SetRemarkModel model = new SetRemarkModel();

    @Override
    public void start() {
        String remarks = SpUtils.get(view.getContext(), Constant.SPNAME, Constant.SpKey.CheckRemarks, Constant.DEFAULT_REMARK);
        if (!TextUtils.isEmpty(remarks)) {
            view.showRemarkView(remarks.split("!"));
        }
    }

    @Override
    public void saveRemarks(String remarks) {
        SpUtils.put(view.getContext(), Constant.SPNAME, Constant.SpKey.CheckRemarks, remarks);
        view.toast("验券备注保存成功");
        view.finish();
    }
}
